Program main

	USE ckvar

	IMPLICIT NONE
	REAL :: atemp,pres,ftemp,temp,adbtmp
	REAL :: phi,phimx,dphi
	INTEGER :: i,n,nc
	open(unit=50,file='thermo.out')

	atemp=500.0	! air temp
	ftemp=298.0	! fuel temp
	pres=2.0
	phi=0.6
	phimx=1.4
	dphi=0.02

	CALL ckinp

	write(50,*) '!!!! Chemical Equilibrium Calculation !!!!'
	write(50,100) 'phi',(spc(i),i=1,nspc),'Adb_Temp'
	do
	nmspc=1.0e-30
	nmspc(1)=1.0		! H2
	nmspc(2)=nmspc(1)*0.5/phi	! O2
	nmspc(3)=nmspc(1)*0.5*3.76/phi	! N2
	CALL heateq(atemp,ftemp,temp)
	write(*,*) 'Equi. Temp=',temp,'@phi=',phi

	CALL thrmeq(temp,pres,phi,adbtmp)
	write(50,200) phi,(mfspc(i),i=1,nspc),adbtmp
	if(phi.ge.phimx) go to 20
	phi=phi+dphi
	enddo
   20	write(*,*) 'Normal termination'

  100	format(10(2x,a8,2x))
  200	format(10(1pe12.5))
End program main
